﻿using DevExpress.XtraReports.UI;
using System.Collections.Generic;
using DataAccess;

namespace QuanLyKhachSan
{
    public partial class XrptThietBiPhong : DevExpress.XtraReports.UI.XtraReport
    {
        ThietBiPhongManager controller = new ThietBiPhongManager();
        public XrptThietBiPhong(string loaiphong,string tenloaiphong)
        {
            InitializeComponent();
            FormIn_Load(loaiphong);
            xrlblLoaiPhong.Text = tenloaiphong;
        }

        private void FormIn_Load(string LoaiPhong)
        {
            List<ThietBiPhong> list = controller.TimKiemTheoDK(tbp => tbp.MaLoaiPhong == LoaiPhong).Result;
            foreach (var tbp in list)
            {
                XRTableCell cell1 = new XRTableCell();
                XRTableCell cell2 = new XRTableCell();
                XRTableCell cell3 = new XRTableCell();
                XRTableCell cell4 = new XRTableCell();
                XRTableCell cell5 = new XRTableCell();

                cell3.TextAlignment = DevExpress.XtraPrinting.TextAlignment.MiddleRight;

                cell1.WidthF = 99.9f;
                cell2.WidthF = 200;
                cell3.WidthF = 100;
                cell4.WidthF = 100;
                cell5.WidthF = 149.65f;

                cell1.Text = tbp.MaTB;
                cell2.Text = tbp.TenTB;
                cell3.Text = tbp.SoLuong+"";
                cell4.Text = tbp.DonVi;
                cell5.Text = tbp.ThietBiCoDinh ? "X" : "";

                XRTableRow row = new XRTableRow();
                row.Cells.Add(cell1);
                row.Cells.Add(cell2);
                row.Cells.Add(cell3);
                row.Cells.Add(cell4);
                row.Cells.Add(cell5);

                xrTable2.Rows.Add(row);
            }
            xrTable2.Rows[0].Visible = false;
        }
    }
}
